# encoding: utf-8
# project: deep_learning
# file: pooling_1d.py
# time: 2024-12-13 14:39
# author: abcuqe
# license: copyright@ 2002-2024
# contact: abcque@outlook.com
# IDE: PyCharm
# description: 
import os
import tensorflow as tf
from keras.layers import MaxPooling1D, GlobalMaxPooling1D, GlobalAveragePooling1D

if __name__ == '__main__':
    os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

    x = tf.constant([1, -2, 3, -1, 2, 1])
    x = tf.reshape(x, [1, 6,1])

    # pooling = MaxPooling1D()
    # y = pooling(x)
    # print(y.shape)

    pooling = GlobalMaxPooling1D()
    y = pooling(x)
    print(y.shape)
    print(y)

    pooling = GlobalAveragePooling1D()
    y = pooling(x)
    print(y.shape)
    print(y)



